﻿@model Invoicing.Model.Products.WarehouseModel


<div class="GeneralEdit" id="fmWarehouse">
    <ul>
        <li>
            <label for="txtHouse">仓库名称：</label>
            <input type="text" class="k-textbox" id="txtHouse" name="house" value="@Model.House" maxlength="50" pattern=".{2,}" required validationMessage="请输入仓库名称" />
            <span class="k-invalid-msg" data-for="house"></span>
        </li>
        <li class="editButtons">
            <button id="btnSaveWarehouse" class="k-button"><span class="k-icon k-i-tick"></span><span>确认提交</span></button>
            &nbsp;&nbsp;
            <button class="k-button" onclick="CancelGeneralEdit();"><span class="k-icon k-i-cancel"></span><span>&nbsp;返&nbsp;回</span></button>
        </li>
    </ul>
</div>

<script class="save_warehouse">
    $(function () {
        var validator = $("#fmWarehouse").kendoValidator().data("kendoValidator");
        $("#btnSaveWarehouse").click(function (e) {
            if (validator.validate()) {
                var values = {
                    id: "@Model.ID",
                    house: $("#txtHouse").val()
                };

                Whale.Remote.Operation({
                    url: "/Products/Warehouse/Save",
                    parameters: values,
                    success: function (result) {
                        wndGeneralEdit.close();
                        if ($("#grid_warehouse").length > 0)
                            $("#grid_warehouse").data("kendoGrid").dataSource.read();
                    },
                    error: function (msg) {
                        wndGeneralInformation.content(msg).open();
                    }
                });
            }
            return false;
        });
    });
</script>
